﻿@{
    ViewBag.Title = "SearchBySinger";
    Layout = "~/Views/Shared/_LayoutPublic.cshtml";
    
}
<link href="../../Styles/Tabs.css" rel="stylesheet" type="text/css" />
<link href="../../Styles/SearchPage.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    window.onload = loadKeyword();
    function loadKeyword() { 
        document.getElementById('txt_search').value = '@ViewBag.singerName'.toString();
    }
</script>
<div id="search-content">
<div id="menu-search-result">
    <ul>
        <li><a href="/search/Search_bySingerName?pageindex=1&option=song&singerName=@ViewBag.singerName">Bài Hát</a></li>
        |
        <li><a href="/search/Search_bySingerName?pageindex=1&option=video&singerName=@ViewBag.singerName">Video</a></li>
        |
        <li><a href="/search/Search_bySingerName?pageindex=1&option=album&singerName=@ViewBag.singerName">Album</a></li>
    </ul>
</div>
<hr />
<div id="search-result">

@if (ViewBag.option == "song")
{
    List<ListenMusic.Song_ServiceReference.SongSinger> lst_songSinger = ViewBag.searchResult;
     <ul>     
        @if (lst_songSinger.Count < 1)
        {
            <p>Hiện chưa có bài hát nào của ca sĩ này</p>
            <p>Nếu bạn có bài hát muốn đóng góp. Hãy vào mục <strong>Upload bài hát</strong> hoặc nhấn <a href="/upload">vào đây</a>.</p>
        }
        else
        {      
            for (int i = 0; i < @lst_songSinger.Count; i++)
            { 
                <li> @Html.ActionLink(@lst_songSinger[i].SongName, "ListenPage", "Listen", new { songid = @lst_songSinger[i].SongID, pageindex = 1 }, new { @class="songName" }) <br />
                    <span class="sub-detail">
                        Trình bày: <a class="singer" href="#">@lst_songSinger[i].SingerName</a> | Lượt nghe: @lst_songSinger[i].CountView
                    </span>
                </li>
            <hr />
            }           
            <li class="page-number">
                Trang: 
                @for (int k = 1; k <= @ViewBag.totalSong; k++)
                { 
                    <a href="/search/Search_bySingerName?pageindex=@k&option=song&singerName=@ViewBag.singerName">@k</a>
                }
            </li>
        }              
    </ul>
}
else if (ViewBag.option == "video")
{
    List<ListenMusic.Video_ServiceReference.SongSinger> lst_videoSinger = ViewBag.searchResult;
     <ul>     
        @if (lst_videoSinger.Count < 1)
        {
            <p>Hiện chưa có video clip nào của ca sĩ này</p>
            <p>Nếu bạn có video clip  muốn đóng góp. Hãy vào mục <strong>Upload bài hát</strong> hoặc nhấn <a href="/upload">vào đây</a>.</p>
        }
        else
        {
            for (int i = 0; i < @lst_videoSinger.Count; i++)
            { 
                <li> @Html.ActionLink(@lst_videoSinger[i].SongName, "ListenPage", "ViewVideos", new { videoid = @lst_videoSinger[i].SongID, pageindex = 1 }, new { @class = "songName" }) <br />
                    <span class="sub-detail">
                        Trình bày: <a class="singer" href="#">@lst_videoSinger[i].SingerName</a> | Lượt nghe: @lst_videoSinger[i].CountView
                    </span>
                </li>
              <hr />
            }
            <li class="page-number">
                Trang: 
                @for (int k = 1; k <= @ViewBag.totalVideo; k++)
                { 
                    <a href="/search/Search_bySingerName?pageindex=@k&option=video&singerName=@ViewBag.keyword">@k</a>
                }
            </li>
        }              
    </ul>
}
else
{
    List<ListenMusic.Album_ServiceReference.AlbumSinger> lst_albumSinger = ViewBag.searchResult;
     <ul>     
        @if (lst_albumSinger.Count < 1)
        {
            <p>Hiện chưa có album nào của ca sĩ này</p>
        }
        else
        {
            for (int i = 0; i < @lst_albumSinger.Count; i++)
            { 
                <table class="album-content">
                <tr class="album-details">
                    <td class="picture-album">
                        <a href="/listen/listenalbumpage?albumid=@lst_albumSinger[i].AlbumID"><img src="../../Images/albums/@lst_albumSinger[i].Picture" alt="" title="@lst_albumSinger[i].AlbumName" width="130px" height="130px" /></a>
                    </td>   
                    <td class="album-name">
                        <a href="/listen/listenalbumpage?albumid=@lst_albumSinger[i].AlbumID" class="songName">@lst_albumSinger[i].AlbumName</a> <br />
                        <span class="sub-detail">
                            Trình bày: <a class="singer" href="/search/Search_bySingerName?pageindex=1&option=song&singerName=@lst_albumSinger[i].SingerName">@lst_albumSinger[i].SingerName</a> <br />                   
                            Năm phát hành: @lst_albumSinger[i].ReleaseYear <br />                    
                            Lượt nghe: @lst_albumSinger[i].CountView
                        </span>
                    </td>
                </tr> 
                </table> 
            }
             <li class="page-number">
                Trang: 
                @for (int k = 1; k <= @ViewBag.totalVideo; k++)
                { 
                    <a href="/search/Search_bySingerName?pageindex=@k&option=album&singerName=@ViewBag.keyword">@k</a>
                }
            </li>
        }              
    </ul>
}
</div>
</div>
